package org.unei.multiprocessor.sharememory;

public class RegBooleanMRSWRegister implements Register<Boolean>{

	ThreadLocal<Boolean> last;
	boolean s_value;
	
	RegBooleanMRSWRegister(int capacity){
		last=new ThreadLocal<Boolean>(){
			protected Boolean initialValue(){
				return false;
			}
		};
	}
	
	@Override
	public Boolean read() {
		return s_value;
	}

	@Override
	public void write(Boolean v) {
		if(v!=last.get()){
			last.set(v);
			s_value=v;
		}
	}

}
